package pl.edu.pw.polygen.modeler.client.toolbox.buttons;

import pl.edu.pw.polygen.modeler.client.toolbox.command.HoleCommand;
import pl.edu.pw.polygen.modeler.client.toolbox.command.ICommand;
import pl.edu.pw.polygen.modeler.client.workspace.IWorkspace;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;

public class HoleButton extends Button {

	private ICommand command;

	public HoleButton(IWorkspace workspace) {
		super();
		this.initialize(workspace);
	}

	private void initialize(IWorkspace workspace) {
		this.setText("Hole");
		this.setHeight("40px");
		this.setWidth("66px");
		command = new HoleCommand(workspace);
		this.addClickAction();
	}

	private void addClickAction() {
		this.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				command.execute();
			}
		});
	}

}
